package com.tzl.design_pattern.observer_pattern.observer_pattern_in_jdk;

/**
 * jdk实现的观察者模式,实现了消息的推送拉取
 *
 * @author Zhilei Tang
 * @date Created in 2020/11/14 22:11
 */
public class ObserverTest {
  public static void main(String[] args) {
    Zone zone = new Zone();
    Friends friends = new Friends();
    friends.setFriendName("李四");

    Trends trends = new Trends();
    trends.setNickName("张三");
    trends.setContent("生而为人,我很嚣张!");
    zone.addObserver(friends);
    zone.publishTrends(trends);
  }
}
